#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
void stringdelete(string n, int b, int k)
{
	int i;
	for (i = b; i <= n.length()-k; i++)
	{
		n[i] = n[i + k];
	}
}

int main()
{
	string n;
	int s, i, j, j1, c, data[100], len;
	cin >> n >> s;
	len = n.length();
	if (s > len) { cout << "data error"; return 1; }
	j1 = 0;
	for (i = 1; i <= s; i++)
	{
		for (j = 1; j < n.length(); j++)
		{
			if (n[j] > n[j + 1])
			{
				stringdelete(n, j, 1);
				if (j > j1) data[i] = j + i;
				else data[i] = data[i - 1] - 1;
				j1 = j;
				break;
			}
			
		}
		if (j > n.length()) break;
	}
	for (i = i; i <= s; i++)
	{
		j = len - i + 1;
		stringdelete(n, j, 1);
		data[i] = j;

	}
	while(n[1]=='0'&&n.length()>1)stringdelete()
	return 0;
}